<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>完整demo</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" charset="utf-8" src="ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="ueditor.all.min.js"></script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
    <style type="text/css">
        div {
            width: 100%;
        }

        h1 {
            text-align: center
        }
    </style>
</head>
<body>
<div>
    <table border="0" style="border-collapse: collapse;margin-bottom: 10px">
        <tr>
            <td>请输入标题：</td>
            <td><input id="title" style="width: 300px"></td>
        </tr>
    </table>
    <script id="editor" type="text/plain" style="width:100%;height:350px;"></script>
</div>
<div id="btns">
    <div style="margin: 16px auto;width: 100px;">
        <button onclick="getContent()">确认发贴</button>
    </div>
</div>
<script type="text/javascript">
    var ue = UE.getEditor('editor');
    function getContent() {
        var title = $("#title").val().trim();
        var contents = UE.getEditor('editor').getContent();
        if(title == "" || contents == ""){
            alert("发贴时，标题和内容都必须要输入！");
        }
        else{
            $.ajax({
                url:'../postContents.php',
                data:{title:title,contents:contents},
                type:'post',
                dataType:'json',
                success:function (d) {
                    if(d.error == 1){
                        alert(d.errMsg);
                    }
                    else{
                        window.parent.close1();
                        alert('发贴成功');
                       window.parent.location.href = '../index.php';
                    }
                },
                error:function () {

                }
            })
        }
        //UE.getEditor('editor').getContent()
    }
</script>
</body>
</html>